import Vue from 'vue'
import VueRouter from 'vue-router'
import {
	Message
} from 'element-ui';
Vue.use(VueRouter)
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
	return VueRouterPush.call(this, to).catch(err => err)
}
const route = new VueRouter({
	routes: [{
			path: '/login',
			component: () => import('@/components/login')
		},
		{
			path: '/home',
			component: () => import('@/components/home'),
			redirect: '/welcome',
			children: [{
					path: '/welcome',
					component: () => import('@/components/welcome')
				},
				{
					path: '/userlist',
					component: () => import('@/components/admin/userList')
				},
				{
					path: '/thingslist',
					component: () => import('@/components/admin/thingslist')
				}
			]
		},
		{
			path: '*',
			redirect: '/welcome'
		}
	],
	mode: 'hash',
	base: process.env.BASE_URL
})

export default route
